<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="jquery-3.4.1.min.js"></script>
    <script>
        function getCity(){
            //知道是哪个省
            var provinceid = $("[name='province']").val();
            var cid,cname;
            $.ajax({
                url:'city.xml',
                dataType:'xml',
                success:function(res){
                    $("[name='city']").empty();
                    $(res).find("[id="+provinceid+"] city").each(function(){
                        cid = $(this).attr("id");
                        cname = $(this).attr("name");
                        $("[name='city']").append("<option value="+cid+">"+cname+"</option>");
                    });
                }
            });
        }

        $(document).ready(function(){
            var pid,pname;
            $.ajax({
                url:'city.xml',
                dataType:'xml',
                success:function(res){
                    $(res).find('province').each(function(){
                        pid = $(this).attr("id");
                        pname = $(this).attr("name");
                        $("[name='province']").append("<option value="+pid+">"+pname+"</option>");
                    });
                    getCity();
                }
            });
            $("[name='province']").change(getCity);
        });
    </script>
</head>
<body>
    省：<select name="province"></select>
    市：<select name="city"></select>
</body>
</html>